/*
 * LiquidBounce Hacked Client
 * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
 * https://github.com/CCBlueX/LiquidBounce/
 */
package net.ccbluex.liquidbounce.features.module.modules.exploit

import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.ModuleInfo
import net.ccbluex.liquidbounce.value.IntegerValue
import net.ccbluex.liquidbounce.value.ListValue

@ModuleInfo(name = "Damage", description = "Deals damage to yourself.", category = ModuleCategory.EXPLOIT, canEnable = false)
class Damage : Module() {

    private val modeValue = ListValue("Mode", arrayOf("NCP", "AAC"), "NCP")
    private val damageValue = IntegerValue("Damage", 1, 1, 20)

    override fun onEnable() {
        val thePlayer = mc.thePlayer ?: return

        when (modeValue.get().toLowerCase()) {
            "ncp" -> {
                val x = thePlayer.posX
                val y = thePlayer.posY
                val z = thePlayer.posZ

                repeat(65 * damageValue.get()) {
                    mc.netHandler.addToSendQueue(classProvider.createCPacketPlayerPosition(x, y + 0.049, z, false))
                    mc.netHandler.addToSendQueue(classProvider.createCPacketPlayerPosition(x, y, z, false))
                }
                mc.netHandler.addToSendQueue(classProvider.createCPacketPlayerPosition(x, y, z, true))
            }
            "aac" -> thePlayer.motionY = 5 * damageValue.get().toDouble()
        }
    }

}